home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / earkit / ftp / gui-ftp / rexx / ls-short.filter < prev    next >
Text File  |  1998-05-24  |  1KB  |  53 lines

  1. /* REXX */
  2. /*
  3. ** ls-short.filter
  4. **
  5. ** Convert directory listings obtained with NLST (name list) to a usable
  6. ** format.  NLST listings should have one file/directory name per line.
  7. ** if you are unable to determine whether a name is a file or a directory
  8. ** then mark it as a link.
  9. **
  10. ** It is left to you to expand this to handle more than one name per line.
  11. */
  12.  
  13. do until eof( STDIN )
  14.     parse pull T$
  15.     if ~ eof( STDIN ) then do
  16.         if T$ > "" then do
  17.             SPECIAL = right( T$, 1 )
  18.             select
  19.                 when SPECIAL = '/' then do
  20.                     DIR = 'd'
  21.                     T$  = LEFT( T$, wordlength(T$,1) - 1 )
  22.                 end
  23.                 when SPECIAL = '@' then do
  24.                     DIR = 'l'
  25.                     T$  = LEFT( T$, wordlength(T$,1) - 1 )
  26.                 end
  27.                 when SPECIAL = '|' then do
  28.                     DIR = 'p'
  29.                     T$  = LEFT( T$, wordlength(T$,1) - 1 )
  30.                 end
  31.                 when SPECIAL = '=' then do
  32.                     DIR = 's'
  33.                     T$  = LEFT( T$, wordlength(T$,1) - 1 )
  34.                 end
  35.                 when SPECIAL = '*' then do
  36.                     DIR = '-'
  37.                     T$  = LEFT( T$, wordlength(T$,1) - 1 )
  38.                 end
  39.                 otherwise do
  40.                     DIR = '-'
  41.                 end
  42.             end
  43.             OUTLINE = DIR || 'rwxrwxrwx 1 nobody nobody 0 ??? ?? ???? ' || T$
  44.             say OUTLINE
  45.         end
  46.     end
  47. end
  48.  
  49. exit 0
  50.  
  51.  
  52.  
  53.